
import { axiosError, defaultErrorMessage } from 'src/util/errorHandler';
import http from 'src/util/http';


type PostAuthMeRequest = any
type PostAuthMeResponse = any



const postMe = async (data: PostAuthMeRequest) => {
  try {
    return await http.post<PostAuthMeResponse, PostAuthMeRequest>(`User/getUserInfo?uMail=${data.uMail}&token=${data.token}`);
  } catch (e) {
    const error = axiosError(e);
    // if (error.response?.status === 400 && error.response.data.code === 0)
    //   throw t('error.me.oldPasswordError');
    throw defaultErrorMessage(error);
  }
};


const postBase = async () => {
  try {
    return await http.post<PostAuthMeResponse, PostAuthMeRequest>(`SysConfig/getSystemConfig`);
  } catch (e) {
    const error = axiosError(e);
    // if (error.response?.status === 400 && error.response.data.code === 0)
    //   throw t('error.me.oldPasswordError');
    throw defaultErrorMessage(error);
  }
};

export default {
  postMe,
  postBase
};
